Skip to content

Conversation

@alinaliBQ
Copy link
Contributor

@alinaliBQ alinaliBQ commented Oct 8, 2025

Rationale for this change

ODBC needs to give BI tools information about the driver itself and the data source it is connected to.

What changes are included in this PR?

  • Implementation of SQLGetinfo to return driver and data source information
  • Add default values for SQLGetInfo in get_info_cache.cc
  • Tests

Are these changes tested?

Tested on local MSVC Windows

Are there any user-facing changes?

No

@alinaliBQ
Copy link
Contributor Author

@lidavidm @kou Please review this draft ODBC API PR. The testing folder structure will be in a separate PR

@github-actions
Copy link

github-actions bot commented Oct 8, 2025

⚠️ GitHub issue #47709 has been automatically assigned in GitHub to PR creator.

// Driver Information

TYPED_TEST(FlightSQLODBCTestBase, TestSQLGetInfoActiveEnvironments) {
this->Connect();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the connect/disconnect be put in a SetUp/TearDown?

Also it might not be wise to add the tests directly to FlightSQLODBCTestBase; could we create a fixture for this test suite specifically (by subclassing)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, added separate test fixture ConnectionInfoTest

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Oct 9, 2025
TYPED_TEST(FlightSQLODBCTestBase, TestSQLGetInfoDriverName) {
this->Connect();

Validate(this->conn, SQL_DRIVER_NAME, (SQLWCHAR*)L"Arrow Flight ODBC Driver");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use static_cast?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, fixed

Copy link
Contributor Author

@alinaliBQ alinaliBQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked on code review comments

// Driver Information

TYPED_TEST(FlightSQLODBCTestBase, TestSQLGetInfoActiveEnvironments) {
this->Connect();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, added separate test fixture ConnectionInfoTest

TYPED_TEST(FlightSQLODBCTestBase, TestSQLGetInfoDriverName) {
this->Connect();

Validate(this->conn, SQL_DRIVER_NAME, (SQLWCHAR*)L"Arrow Flight ODBC Driver");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, fixed

@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 20, 2025
@github-actions github-actions bot added awaiting changes Awaiting changes awaiting change review Awaiting change review and removed awaiting change review Awaiting change review awaiting changes Awaiting changes labels Oct 21, 2025
Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase!

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Oct 22, 2025
@alinaliBQ alinaliBQ force-pushed the gh-47709-sql-get-info branch from 5452bfd to f7a7386 Compare October 22, 2025 18:50
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 22, 2025
@alinaliBQ alinaliBQ requested a review from lidavidm October 22, 2025 23:08
Comment on lines 97 to 98
void ValidateGreaterThan(SQLHDBC connection, SQLUSMALLINT info_type,
SQLULEN compared_value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do have the same general comment: I think you would be better off creating utility getters (that throw if they fail) and then using standard GTest assertions, instead of making a function for every combination of data type and comparator. (Also, can they be shared across test files?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea when I saw your comment on the SQLStmtAttr PR, I thought of this PR as well since it also has the GreaterThan functions. I was waiting to see if the changes we made for SQLStmtAttr PR #47773 are what you are looking for. This is something we will be working on for sure.

On the other note, I am not sure if sharing certain utility getter across test files would be useful, since for example SQLGetInfo will only be called in connection_info_test.cc and no other test files. We won't be having copies of utility getters in different test files. 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, if this is the same test file then never mind that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lidavidm I have fixed and added the utility getters, please have another look, thanks!

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Oct 31, 2025
@alinaliBQ alinaliBQ force-pushed the gh-47709-sql-get-info branch from f7a7386 to f4aec24 Compare November 8, 2025 00:29
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 8, 2025
Copy link
Contributor Author

@alinaliBQ alinaliBQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed code review comments

Comment on lines 97 to 98
void ValidateGreaterThan(SQLHDBC connection, SQLUSMALLINT info_type,
SQLULEN compared_value) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lidavidm I have fixed and added the utility getters, please have another look, thanks!

@kou kou changed the title GH-47709 : [C++][FlightRPC] Return ODBC and data source information GH-47709: [C++][FlightRPC] Return ODBC and data source information Nov 9, 2025
@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Nov 10, 2025
@alinaliBQ alinaliBQ force-pushed the gh-47709-sql-get-info branch 4 times, most recently from 605971d to fc711ae Compare November 20, 2025 22:12
Co-Authored-By: rscales <[email protected]>

Create connection_info_test.cc

Add SQLGetInfo tests

Co-authored-by: justing-bq <[email protected]>
Co-Authored-By: rscales <[email protected]>

Address code review comments

Co-authored-by: justing-bq <[email protected]>

Work on code review comments

Fix build issues with tests

Use Utility getters for SQLGetInfo

Remove `using List`

* fix build issues

Add truncation test
@alinaliBQ alinaliBQ force-pushed the gh-47709-sql-get-info branch from fc711ae to c701849 Compare November 29, 2025 00:35
@alinaliBQ
Copy link
Contributor Author

Rebased and tested PR changes on local MSVC. PR is ready to be merged

@alinaliBQ alinaliBQ marked this pull request as ready for review November 29, 2025 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants